package 第二章实用类;
import javax.xml.crypto.dsig.SignatureMethod;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;
import java.util.Calendar;
import java.util.Scanner;

public class work1 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("请输入第一个时间的年份");
        int year1=input.nextInt();
        System.out.println("请输入第一个时间的月份");
        int month1=input.nextInt();
        System.out.println("请输入第一个时间的日期");
        int day1=input.nextInt();
        System.out.println("请输入第二个时间的年份");
        int year2=input.nextInt();
        System.out.println("请输入第二个时间的月份");
        int month2=input.nextInt();
        System.out.println("请输入第二个时间的日期");
        int day2=input.nextInt();
        Calendar calendar= Calendar.getInstance();
        int yearDays=0;int monthDays=0;
        calendar.set(year1,month1,day1);
        for (int i =year1; i <year2 ; i++) {
            Calendar calendar1 = Calendar.getInstance();
            calendar1.set(Calendar.YEAR,i);
            yearDays=yearDays+calendar.getActualMaximum(Calendar.DAY_OF_YEAR);
        }
        for (int j = 1; j <month2 ; j++) {
            Calendar calendar2 = Calendar.getInstance();
            calendar2.set(year2,j,day2);
            monthDays=monthDays+calendar2.getActualMaximum(Calendar.DAY_OF_MONTH);
        }
        int days=yearDays+monthDays+day2;
        System.out.println("两个时间相隔天数为："+(days-1));
    }
}